package controller;

import dao.GradeDao;
import model.Grade;
import service.GradeService;
import service.impl.GradeServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet(urlPatterns = "/Educational/student/getgrade")
public class GradeGetServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        GradeService gradeService = new GradeServiceImpl();
        List<Grade> grades = gradeService.getGrades();
        req.setAttribute("grades", grades);
        req.getRequestDispatcher("/Educational/student/add.jsp").forward(req, resp);
    }
}
